package com.spt.ws.dao.impl;

import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Types;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.dao.DataAccessException;
import org.springframework.jdbc.core.CallableStatementCallback;
import org.springframework.jdbc.core.CallableStatementCreator;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.spt.core.Property;
import com.spt.fjj.service.models.common.AnnotationCommonService;
import com.spt.ws.dao.IDaoService;

@Service
public class DaoServiceImpl extends AnnotationCommonService implements IDaoService {
	private static Logger log = LogManager.getLogger("com.spt.ws.ws");
	private String[] getLines(String parm){
		return parm.split("\\|\\|");
	}
	private String[] getCells(String line){
		String tmp = line.trim();
		if(tmp.startsWith("::")) tmp = tmp.substring(2);
		String t[] = tmp.split("::");
		for (int i = 0;i < t.length; i++){
			t[i] = t[i].trim();
		}
		return t;
	}
	private String[] getCells(String line,int len){
		String tmp = line.trim();
		if(tmp.startsWith("::")) tmp = tmp.substring(2);
		String t[] = tmp.split("::",len);
		for (int i = 0;i < t.length; i++){
			t[i] = t[i].trim();
		}
		return t;
	}
	
	@Transactional(rollbackFor=Exception.class)
	@Override
	public void getYJGK(String parm) throws Exception {
		//s = s.replace(" ", "");
		//

		String del = "delete from BGFJJ_TYJGK where yjtm =? and cjdm=?";
		String ins = "insert into BGFJJ_TYJGK (YJID,YJXH,YJTM,SJJDM,JDJDM,BEIZHUDM,ZL,KCSJ,JSBZ,CJDM,QSQDID,LXGK,DDXH,GKYJZL,JB) values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
		String rt = "";
		int i = 1;
		try {
			String[] lines = this.getLines(parm);
			//dao.beginTransaction();
			for (String line : lines) {
				String[] cells = this.getCells(line);
				/*if(cells.length != 15){
					rt += i + ",";
					continue;
				}*/
				this._delete(del, cells[2], cells[9]);
				this._insert(ins, cells);
			}
		} catch (Exception e) {
			rt += i + ",";
			log.info(e.getMessage());
			throw new RuntimeException("error at line " + rt );
		}
	}
	@Transactional(rollbackFor=Exception.class)
	@Override
	public void getGKSG(String parm) throws Exception{
		String rt = "";
		String sgbz = "0";
		int i = 1;
		try {
			String[] lines = this.getLines(parm);
			for (String line : lines) {
				
				String[] cells = this.getCells(line);
				String gz_num = cells[3];
				
				//String gk = map_gk.get(cells[0]) + gz_num;
				String zt = null;
				if("1".equals(cells[4])){
				    sgbz = "1";
				}
				String usql = "update bgfjj_tpadsgb set sgbz = ? where wlgkh = ?";
				this._update(usql,sgbz,gz_num);
				i++;
			}
		} catch (Exception e) {
			rt += i + ",";
			log.info(e.getMessage());
			throw new RuntimeException("can not change status at line " + rt );
		}
	}
	@Transactional(rollbackFor=Exception.class)
	@Override
	public void getLXGK(String parm) {
		
		String del = "delete from BGFJJ_TLXGKB where yldm=?";
		String ins = "insert into BGFJJ_TLXGKB (CJDM,LXGK,YJZL,DDXH,YLDM,XJZ,QSSJ,JZSJ,QSRQ,ZZRQ,JB) "
				+ "values(?,?,?,?,?,?,?,?,to_date(?,'YYYYMMDDHH24MISS'),to_date(?,'YYYYMMDDHH24MISS'),?)";
		String rt = "";
		int curLine = 1;
		String[] lines = this.getLines(parm);
		try{
			for (String line : lines) {
				String[] cells = this.getCells(line);
				/*if(cells.length != 11){
					rt += curLine + ",";
					continue;
				}*/
				this._delete(del, cells[4]);
				curLine++;
			}
		}catch (Exception e) {
			rt += curLine + ",";
			log.info(e.getMessage());
			throw new RuntimeException("del line " + rt + " error.  parm=" + parm);
		}
		try{
			for (String line : lines) {
				String[] cells = this.getCells(line);
				/*if(cells.length != 11){
					continue;
				}*/
				this._insert(ins, cells);
				curLine++;
			}
		}catch (Exception e) {
			rt += curLine + ",";
			log.info(e.getMessage());
			throw new RuntimeException("insert line " + rt + " error.");
		}
		
	}
	@Transactional(rollbackFor=Exception.class)
	@Override
	public void getWLGKQH(String parm) {
		String ins = "insert into BGFJJ_TWLGKQHB (SBID,CJDM,FAID,YLDM,LXGK,OLDWLGKHM,NEWWLGKHM,NEWYLDM,QSRQ,JZRQ) "
				+ "values(?,?,?,?,?,?,?,?,to_date(?,'YYYYMMDDHH24MISS'),to_date(?,'YYYYMMDDHH24MISS'))";
		String rt = "";
		int i = 1;
		try {
			String[] lines = this.getLines(parm);
			for (String line : lines) {
				String[] cells = this.getCells(line);
				/*if(cells.length != 10){
					rt += i + ",";
					continue;
				}*/
				this._insert(ins, cells);
				i++;
			}
		} catch (Exception e) {
			rt += i + ",";
			log.info(e.getMessage());
			throw new RuntimeException("insert line " + rt + " error.");
		}
		
	}
	@Transactional(rollbackFor=Exception.class)
	@Override
	public void getCZYB(String parm) {
		String ins = "insert into BGFJJ_TCZYB (CZYDM,CZYM,MM,CZYJB,CJDM,BCDM,JSDM,PDAJS) values(?,?,?,?,?,?,?,?)";
		String rt = "";
		int i = 1;
		String[] lines = this.getLines(parm);
		try {
			this._delete("delete from BGFJJ_TCZYB");
		} catch (Exception e) {
			e.printStackTrace();
			throw new RuntimeException("delete table BGFJJ_TCZYB error ");
		}
		try {
			for (String line : lines) {
				String[] cells = this.getCells(line);
				/*if(cells.length != 8){
					rt += i + ",";
					continue;
				}*/
				this._insert(ins, cells);
				i++;
			}

		} catch (Exception e) {
			rt += i + ",";
			log.info(e.getMessage());
			throw new RuntimeException("insert line " + rt + " error.");
		}
		
	}
	@Transactional(rollbackFor=Exception.class)
	@Override
	public void getJFFA(String parm) {
		String ins = "insert into BGFJJ_TJFFAB (FAID,CJDM,YLDM,XJZ,JDJDM,WLGKHM,BYWLGK1,BYWLGK2,BYWLGK3,ZLGKBZ,QSRQ,ZZRQ) values(?,?,?,?,?,?,?,?,?,?,to_date(?,'YYYYMMDDHH24MISS'),to_date(?,'YYYYMMDDHH24MISS'))";
		String rt = "";
		int i = 1;
		String[] lines = this.getLines(parm);
		try {
			this._delete("delete from BGFJJ_TJFFAB");
		} catch (Exception e) {
			e.printStackTrace();
			throw new RuntimeException("delete table BGFJJ_TJFFAB error ");
		}
		try {
			for (String line : lines) {
				String[] cells = this.getCells(line);
				/*if(cells.length != 12){
					rt += i + ",";
					continue;
				}*/
				this._insert(ins, cells);
				i++;
			}

		} catch (Exception e) {
			rt += i + ",";
			log.info(e.getMessage());
			throw new RuntimeException("insert line " + rt + " error.");
		}
		
	}
	
	@Transactional(rollbackFor=Exception.class)
	@Override
	public void getDQFA(String parm) {
		
		String presql = "delete from BGFJJ_TWLGKQHB where (cjdm,sbid) not in( select cjdm,faid from BGFJJ_TDQFAB where cjdm=? and sbid=? ) and cjdm=?  and sbid=?";
		String ins = "insert into BGFJJ_TDQFAB(SBID,CJDM,FAID,SCSJ) values(?,?,?,to_date(?,'YYYYMMDDHH24MISS'))";
		String rt = "";
		int i = 1;
		try {
			this._delete("delete from BGFJJ_TDQFAB");
		} catch (Exception e) {
			log.info(e.getMessage());
			throw new RuntimeException("delete table BGFJJ_TDQFAB error ");
		}
		try {
			String[] lines = this.getLines(parm);
			
			for (String line : lines) {
				String[] cells = this.getCells(line);
				/*if(cells.length != 4){
					rt += i + ",";
					continue;
				}*/
				this._delete(presql,cells[1],cells[0],cells[1],cells[0]);
				this._insert(ins, cells);
				i++;

			}
		} catch (Exception e) {
			rt += i + ",";
			log.info(e.getMessage());
			throw new RuntimeException("insert line " + rt + " error.");
		}
		
	}
	
	@Transactional(rollbackFor=Exception.class)
	@Override
	public void getGKSX(String parm) {
		
		String ins = "insert into BGFJJ_TGKSXB(CJDM,YJZL,GKHM,JDJDM,JDJJP,GKMC,DDXH,JB) values(?,?,?,?,?,?,?,?)";
		String rt = "";
		int i = 1;
		try {
			this._delete("delete from BGFJJ_TGKSXB");
		} catch (Exception e) {
			log.info(e.getMessage());
			throw new RuntimeException("delete table BGFJJ_TGKSXB error ");
		}
		try {
			String[] lines = this.getLines(parm);
			
			for (String line : lines) {
				String[] cells = this.getCells(line);
				/*if(cells.length != 8){
					rt += i + ",";
					continue;
				}*/
				this._insert(ins, cells);
				i++;
			}
		} catch (Exception e) {
			rt += i + ",";
			log.info(e.getMessage());
			throw new RuntimeException("insert line " + rt + " error.");
		}
		
	}
	
	@Transactional(rollbackFor=Exception.class)
	@Override
	public void getZXJDS(String parm) {
		
		String ins = "insert into BGFJJ_TZXJDS(SFDM,ZXJDM,DSDM,JP,JGJC,QSRQ,ZZRQ) values(?,?,?,?,?,to_date(?,'YYYYMMDDHH24MISS'),to_date(?,'YYYYMMDDHH24MISS'))";
		String rt = "";
		int i = 1;
		try {
			this._delete("delete from BGFJJ_TZXJDS");
		} catch (Exception e) {
			log.info(e.getMessage());
			throw new RuntimeException("delete table BGFJJ_TZXJDS error ");
		}
		try {
			String[] lines = this.getLines(parm);
			
			for (String line : lines) {
				String[] cells = this.getCells(line);
				/*if(cells.length != 7){
					rt += i + ",";
					continue;
				}*/
				this._insert(ins, cells);
				i++;
			}
		} catch (Exception e) {
			rt += i + ",";
			log.info(e.getMessage());
			throw new RuntimeException("insert line " + rt + " error.");
		}
		
	}
	
	@Transactional(rollbackFor=Exception.class)
	@Override
	public void getDSXS(String parm) {
		
		String ins = "insert into BGFJJ_TDSXS(DSDM,XSDM,JP,JGJC,QSRQ,ZZRQ) values(?,?,?,?,to_date(?,'YYYYMMDDHH24MISS'),to_date(?,'YYYYMMDDHH24MISS'))";
		String rt = "";
		int i = 1;
		try {
			this._delete("delete from BGFJJ_TDSXS");
		} catch (Exception e) {
			log.info(e.getMessage());
			throw new RuntimeException("delete table BGFJJ_TDSXS error ");
		}
		try {
			String[] lines = this.getLines(parm);
			
			for (String line : lines) {
				String[] cells = this.getCells(line);
				/*if(cells.length != 6){
					rt += i + ",";
					continue;
				}*/
				this._insert(ins, cells);
				i++;
			}
		} catch (Exception e) {
			rt += i + ",";
			log.info(e.getMessage());
			throw new RuntimeException("insert line " + rt + " error.");
		}
		
	}
	
	@Transactional(rollbackFor=Exception.class)
	@Override
	public void getXSTD(String parm) {
		
		String ins = "insert into BGFJJ_TXSTD(XSDM,TDDM,JP,JGJC,QSRQ,ZZRQ) values(?,?,?,?,to_date(?,'YYYYMMDDHH24MISS'),to_date(?,'YYYYMMDDHH24MISS'))";
		String rt = "";
		int i = 1;
		try {
			this._delete("delete from BGFJJ_TXSTD");
		} catch (Exception e) {
			log.info(e.getMessage());
			throw new RuntimeException("delete table BGFJJ_TXSTD error ");
		}
		try {
			String[] lines = this.getLines(parm);
			for (String line : lines) {
				String[] cells = this.getCells(line);
				/*if(cells.length != 6){
					rt += i + ",";
					continue;
				}*/
				this._insert(ins, cells);
				i++;
			}
		} catch (Exception e) {
			rt += i + ",";
			log.info(e.getMessage());
			throw new RuntimeException("insert line " + rt + " error.");
		}
		
	}
	
	@Transactional(rollbackFor=Exception.class)
	@Override
	public void getTTDYB(String parm) {
		
		String ins = "insert into BGFJJ_TTDYB(SFDM,TDDM,TDMC,YJZL,QSYB,ZZYB) values(?,?,?,?,?,?)";
		String rt = "";
		int i = 1;
		try {
			this._delete("delete from BGFJJ_TTDYB");
		} catch (Exception e) {
			log.info(e.getMessage());
			throw new RuntimeException("delete table BGFJJ_TTDYB error ");
		}
		try {
			String[] lines = this.getLines(parm);
			
			for (String line : lines) {
				String[] cells = this.getCells(line);
				/*if(cells.length != 6){
					rt += i + ",";
					continue;
				}*/
				this._insert(ins, cells);
				i++;
			}
		} catch (Exception e) {
			rt += i + ",";
			log.info(e.getMessage());
			throw new RuntimeException("insert line " + rt + " error.");
		}
		
	}
	
	@Transactional(rollbackFor=Exception.class)
	@Override
	public void getXSYB(String parm) {
		
		String ins = "insert into BGFJJ_TXSYB(SFDM,XSDM,XSMC,QSYB,ZZYB) values(?,?,?,?,?)";
		String rt = "";
		int i = 1;
		try {
			this._delete("delete from BGFJJ_TXSYB");
		} catch (Exception e) {
			log.info(e.getMessage());
			throw new RuntimeException("delete table BGFJJ_TXSYB error ");
		}
		try {
			String[] lines = this.getLines(parm);
			
			for (String line : lines) {
				String[] cells = this.getCells(line);
				/*if(cells.length != 5){
					rt += i + ",";
					continue;
				}*/
				this._insert(ins, cells);
				i++;
			}
		} catch (Exception e) {
			rt += i + ",";
			log.info(e.getMessage());
			throw new RuntimeException("insert line " + rt + " error.");
		}
		
	}
	
	@Transactional(rollbackFor=Exception.class)
	@Override
	public void getTMYJZL(String parm) {
		
		String ins = "insert into BGFJJ_TTMYJZL(TMYJZL,YJZL) values(?,?)";
		String rt = "";
		int i = 1;
		try {
			this._delete("delete from BGFJJ_TTMYJZL");
		} catch (Exception e) {
			log.info(e.getMessage());
			throw new RuntimeException("delete table BGFJJ_TTMYJZL error ");
		}
		try {
			String[] lines = this.getLines(parm);
			
			for (String line : lines) {
				String[] cells = this.getCells(line);
				/*if(cells.length != 2){
					rt += i + ",";
					continue;
				}*/
				this._insert(ins, cells);
				i++;
			}
		} catch (Exception e) {
			rt += i + ",";
			log.info(e.getMessage());
			throw new RuntimeException("insert line " + rt + " error.");
		}
		
	}
	
	@Transactional(rollbackFor=Exception.class)
	@Override
	public void getTYJZLDYGX(String parm) {
		
		String ins = "insert into BGFJJ_TYJZLDYGX(YJFL,YJZL) values(?,?)";
		String rt = "";
		int i = 1;
		try {
			this._delete("delete from BGFJJ_TYJZLDYGX");
		} catch (Exception e) {
			log.info(e.getMessage());
			throw new RuntimeException("delete table BGFJJ_TYJZLDYGX error ");
		}
		try {
			String[] lines = this.getLines(parm);
			
			for (String line : lines) {
				String[] cells = this.getCells(line);
				/*if(cells.length != 2){
					rt += i + ",";
					continue;
				}*/
				this._insert(ins, cells);
				i++;
			}
		} catch (Exception e) {
			rt += i + ",";
			log.info(e.getMessage());
			throw new RuntimeException("insert line " + rt + " error.");
		}
		
	}
	@Transactional
	private Map<String,String> getParm(String classid) throws Exception{
		String sql = "select sub_class_id,param_value from ST_SYS_PARAM where class_id = '" + classid + "'";
		List<Map<String, Object>> li = this._queryMultex(sql);
		if(li==null || li.size() == 0) return null;
		Map<String,String> parm = new HashMap<String,String>();
		for(Map<String, Object> map : li){
			parm.put((String)map.get("SUB_CLASS_ID"), (String)map.get("PARAM_VALUE"));
		}
		return parm;
	}
	
	@Transactional(rollbackFor=Exception.class)
	@Override
	public void getKCFA(String parm) {

		String presql = "delete from BGFJJ_TKCFAB where FAID=? and CJDM = ? and YJZL=? and JDJDM=?";
		String ins = "insert into BGFJJ_TKCFAB(FAID,CJDM,YJZL,JDJDM,JB,WLGKHM,QSZXRQ,ZZZXRQ) values( ?, ?, ?, ?, ?, ?,  to_date(?,'YYYYMMDDHH24MISS'), to_date(?,'YYYYMMDDHH24MISS'))";
		String rt = "";
		int i = 1;

		try {
			String[] lines = this.getLines(parm);
			
			for (String line : lines) {
				String[] cells = this.getCells(line);
				/*if(cells.length != 8){
					rt += i + ",";
					continue;
				}*/
				this._delete(presql,cells[0],cells[1],cells[2],cells[3]);
				this._insert(ins, cells);
				i++;
			}
		} catch (Exception e) {
			rt += i + ",";
			log.info(e.getMessage());
			throw new RuntimeException("insert line " + rt + " error.");
		}
		
	}
	@Transactional(rollbackFor=Exception.class)
	@Override
	public void getTYLXXZB(String parm) {

		String ins = "insert into BGFJJ_TYLXXZB(YLJB,YLZL,YLXZ,YLDM,YLMC,CHC,PYJ,SFJ,ZDJ,QSZXSJ,JZZXSJ,QSZXRQ,ZZZXRQ,RJ,DW,SXXBS,YLGS) values(?,?,?,?,?,?,?,?,?,to_date(?,'YYYYMMDDHH24MISS'),to_date(?,'YYYYMMDDHH24MISS'),to_date(?,'YYYYMMDDHH24MISS'),to_date(?,'YYYYMMDDHH24MISS'),?,?,?,?)";
		String rt = "";
		int i = 1;
		try {
String[] lines = this.getLines(parm);
			
			for (String line : lines) {
				String[] cells = this.getCells(line);
				/*if(cells.length != 17){
					rt += i + ",";
					continue;
				}*/
				this._delete("delete from BGFJJ_TYLXXZB where yldm =?",cells[3]);
				this._insert(ins, cells);
				i++;
			}
		} catch (Exception e) {
			rt += i + ",";
			log.info(e.getMessage());
			throw new RuntimeException("insert line " + rt + " error.");
		}
		
	}
	
	
	@Transactional(rollbackFor=Exception.class)
	@Override
	public void getTSRYYB(String parm) {

		String ins = "insert into BGFJJ_TSRYYB(SBID,FAID,CJDM,WLGKH,SRYY) values(?,?,?,?,?)";
		String rt = "";
		int i = 1;
		try {
			this._delete("delete from BGFJJ_TSRYYB");
		} catch (Exception e) {
			log.info(e.getMessage());
			throw new RuntimeException("delete table BGFJJ_TSRYYB error ");
		}
		try {
			String[] lines = this.getLines(parm);
			
			for (String line : lines) {
				String[] cells = this.getCells(line);
				/*if(cells.length != 5){
					rt += i + ",";
					continue;
				}*/
				this._insert(ins, cells);
				i++;
			}
		} catch (Exception e) {
			rt += i + ",";
			log.info(e.getMessage());
			throw new RuntimeException("insert line " + rt + " error.");
		}
		
	}
	
	
	
	@Override
	public String getGKXX(String parm) {
		String p[] = parm.split("::",6);
		String rtn = null;
		try {
        String sql = "select GETGKXX(?,?,?) as str from dual";
        rtn = this.jdbcTemplate.queryForObject(sql, String.class,p[2],p[4],p[3]);
		
		}catch (Exception e) {
			log.info(e.getMessage());
			throw new RuntimeException(e.getMessage());
		}
		return rtn;
	}
	
	@Transactional(rollbackFor=Exception.class)
    @Override
    public void getQGKZ(String parm) {
        String ins = "insert into BGFJJ_TQGKZB values(?,?,?,?,?)";
        String update = "update BGFJJ_TPADSGB set sgbz = 3 where wlgkh = ?";
        String rt = "";
        int i = 1;
        /*try {
            this._delete("delete from BGFJJ_TSRYYB");
        } catch (Exception e) {
            log.info(e.getMessage());
            throw new RuntimeException("delete table BGFJJ_TSRYYB error ");
        }*/
        try {
            String[] lines = this.getLines(parm);
            
            for (String line : lines) {
                String[] cells = this.getCells(line);
                /*if(cells.length != 5){
                    rt += i + ",";
                    continue;
                }*/
                //this._insert(ins, cells);
                this._update(update, cells[3]);
                i++;
            }
        } catch (Exception e) {
            rt += i + ",";
            log.info(e.getMessage());
            throw new RuntimeException("insert line " + rt + " error.");
        }
    }
    @Override
    public void getYDQGBZ(String parm) {
        String ins = "insert into BGFJJ_TYDQGKZB values(?,?,?,?,?,?)";
        String rt = "";
        int i = 1;
        /*try {
            this._delete("delete from BGFJJ_TSRYYB");
        } catch (Exception e) {
            log.info(e.getMessage());
            throw new RuntimeException("delete table BGFJJ_TSRYYB error ");
        }*/
        try {
            
            String[] lines = this.getLines(parm);
            this._delete("delete from BGFJJ_TYDQGKZB");
            for (String line : lines) {
                log.info(line);
                String[] cells = this.getCells(line);
                /*if(cells.length != 5){
                    rt += i + ",";
                    continue;
                }*/
                
                log.info(cells[1]+ "  " + cells[2]+ "  " + cells[3]+ "  " + cells[4]+ "  " + cells[5]+ "  " + cells[6]);
                this._insert(ins, cells[1],cells[2],cells[3],cells[4],cells[5],cells[6]);
                i++;
            }
        } catch (Exception e) {
            rt += i + ",";
            log.info(e.getMessage());
            throw new RuntimeException("insert line " + rt + " error.");
        }
    }
    @Override
    public void getWLGKQGKZ(String parm) {
        String ins = "insert into BGFJJ_TWLGKZDQGKZB values(?,to_number(?),?)";
        String rt = "";
        int i = 1;
        /*try {
            this._delete("delete from BGFJJ_TSRYYB");
        } catch (Exception e) {
            log.info(e.getMessage());
            throw new RuntimeException("delete table BGFJJ_TSRYYB error ");
        }*/
        try {
            String[] lines = this.getLines(parm);
            this._delete("delete from BGFJJ_TWLGKZDQGKZB");
            for (String line : lines) {
                log.info(line);
                String[] cells = this.getCells(line);
                /*if(cells.length != 3){
                    rt += i + ",";
                    continue;
                }*/
                log.info(cells[0]+ "  " + cells[1]+ "  " + cells[2]);
                this._insert(ins, cells[0], cells[1], cells[2]);
                i++;
            }
        } catch (Exception e) {
            rt += i + ",";
            log.info(e.getMessage());
            throw new RuntimeException("insert line " + rt + " error.");
        }
    }
	
    @Override
    public void getJBZLTJBZ(String parm) {
        String ins = "insert into BGFJJ_JBZLTJBZ values(?,?,?,?,?,?,?)";
        String rt = "";
        int i = 1;
        try {
            this._delete("delete from BGFJJ_JBZLTJBZ");
        } catch (Exception e) {
            log.info(e.getMessage());
            throw new RuntimeException("delete table BGFJJ_JBZLTJBZ error ");
        }
        try {
            String[] lines = this.getLines(parm);
            
            for (String line : lines) {
                String[] cells = this.getCells(line);
                /*if(cells.length != 5){
                    rt += i + ",";
                    continue;
                }*/
                this._insert(ins, cells);
                i++;
            }
        } catch (Exception e) {
            rt += i + ",";
            log.info(e.getMessage());
            throw new RuntimeException("insert line " + rt + " error.");
        }
    }
    
}
